/*
 * Copyright (c) 2020-2021. the original authors and DEPSEA.ORG
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.depsea.jvm.chapter02.java1;

import sun.security.ec.CurveDB;

import java.net.URL;
import java.security.Provider;

/**
 *
 * @author jaune
 * @since 1.0.0
 */
public class ClassLoaderTest1 {

    public static void main(String[] args) {
        System.out.println("******启动类加载器************");

        URL[] urls = sun.misc.Launcher.getBootstrapClassPath().getURLs();
        for (URL url : urls) {
            System.out.println(url.toExternalForm());
        }

        // 从上面的路径中随意找一个类，查看其类加载器
        ClassLoader classLoader = Provider.class.getClassLoader();
        System.out.println(classLoader);

        System.out.println("************扩展类加载器************");
        String extDirs = System.getProperty("java.ext.dirs");

        // Windows下是：";" ，Mac或者Linux下是：":"
        /*for (String path : extDirs.split(":")) {
            System.out.println(path);
        }*/

        // 从上面的路径中随意找一个类，查看其类加载器
        ClassLoader classLoader1 = CurveDB.class.getClassLoader();
        System.out.println(classLoader1);
    }
}
